<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title></title>
	[#include "/admin/include/admin_static.htm"]
</head>
<body>
	<div class="main_admin_content">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>线下充值</legend>
        </fieldset>
		<div class="site-block">
			<form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block" style="width: 50%">
						<input type="text" name="username" placeholder="请输入充值用户名" required lay-verify="required"  autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">金额</label>
					<div class="layui-input-inline" style="width: 100px;">
						<input type="number" name="money" placeholder="￥" required lay-verify="money" autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入备注" required lay-verify="required" class="layui-textarea" name="remark"></textarea>
                    </div>
                </div>

				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="RechargeForm">充  值</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
				<!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
			</form>
        </div>

        <script type="text/javascript">
            layui.use(['form','layer'], function(){
                var form = layui.form(),$ = layui.jquery;

                form.verify({
                    money: function(value, item){ //value：表单的值、item：表单的DOM对象
                       /* if(!new RegExp("^[1-9]([0-9.]+)?$").test(value)){
                            return '金额必须大于等于1';
                        }*/

						if(value == "0"){
							return "金额不能等于0";
						}
                    }
                });

                //监听提交
                form.on('submit(RechargeForm)', function(data){
					$.ajax({
						url: base + '/admin/account/Recharge.aspx',
						type:"POST",
						data: data.field,
						dataType:"json",
						success:function(result){
                            layui.msg(result.content, 'reload');
						},
						error:function(XMLHttpRequest, status, errorThrown){
							if(XMLHttpRequest.status == 400){
								layer.msg(XMLHttpRequest.responseText, {icon:2})
							}
						}
					});
                    return false;
                });
            });
        </script>
	</div>

</body>
</html>